val ktorVersion: String by project
val telegramVersion: String by project
val ktormVersion: String by project
val log4jVersion: String by project
val junitVersion: String by project
val kredisVersion: String by project
val kotlinCoroutinesVersion: String by project
val mockkVersion: String by project
val koinVersion: String by project

repositories {
    mavenCentral()
    google()
    maven { url = uri("https://jitpack.io") }
}

plugins {
    id("com.github.johnrengelman.shadow") version "8.1.1"
    id("com.autonomousapps.dependency-analysis") version "1.19.0"
}

tasks.shadowJar {
    manifest {
        attributes(
            "Main-Class" to "com.beton.main.MainKt"
        )
    }
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    mergeServiceFiles()

    archiveBaseName.set("Beton")
    archiveClassifier.set("release")
    archiveVersion.set("1.0.0")
}


dependencies {

    implementation(project(mapOf("path" to ":common")))
    implementation(project(mapOf("path" to ":data_assistant")))
    implementation(project(mapOf("path" to ":network")))
    implementation(project(mapOf("path" to ":data_db")))

    // Ktor
    implementation("io.ktor:ktor-server-core:$ktorVersion")

    // Telegram API wrapper
    api("io.github.kotlin-telegram-bot.kotlin-telegram-bot:telegram:$telegramVersion")

    // Ktorm
    implementation("org.ktorm:ktorm-core:$ktormVersion")
    implementation(project(mapOf("path" to ":bot")))
    implementation(project(mapOf("path" to ":api")))
    runtimeOnly("org.ktorm:ktorm-support-postgresql:$ktormVersion")

    // Coroutines
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion")

    // JUnit
    testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
    runtimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
    testImplementation("org.junit.jupiter:junit-jupiter-params")

    // Mockk
    testImplementation("io.mockk:mockk:$mockkVersion")

    // Koin
    implementation("io.insert-koin:koin-core:$koinVersion")

    // KOTLIN SERIALIZATION
    implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
}
